use std::ops::Deref;
struct MyBox<T>(T);
impl<T> MyBox<T> {
    fn new(x: T) -> MyBox<T> {
        MyBox(x)
    }
}
impl<T> Deref for MyBox<T> {
    type Target = T;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
fn main() {
    let x = 5;
    // let y = &x;
    let y = Box::new(x);
    let z = MyBox::new(5);
    assert_eq!(5, x);
    assert_eq!(5, *y);
    assert_eq!(5, *z);
    let m = MyBox::new(String::from("Rust"));
    hello(&m)
}
fn hello(name:&str){
    println!("Hello, {name}!");
}
// Box返回指针，需要解引用
